/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 邓大帅
 * Date: 2023-01-03
 * Time: 21:57
 */
public class FaultNum {
    public static int faultNum(int[] array) {
        final int a = array.length;
        int[] array1 = new int[a+1];
        int b = 0;
        for (int i = 0; i < array.length; i++) {
            array1[array[i]]++;
        }
        for (int i = 0; i < array1.length; i++) {
            if (array1[i] == 0) {
                b = i;
                break;
            }
        }
        return b;
    }

    public static void main(String[] args) {
        int[] array = new int[]{1,3,0};
        System.out.println(faultNum(array));
    }
}
